package com.itheima.controller;

import com.itheima.common.R;
import com.itheima.domain.OmsOrderReturnReason;
import com.itheima.manager.OmsOrderManager;

import com.itheima.vo.PageBeanVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class OmsOrderReturnReasonController {
    @Autowired
    OmsOrderManager omsOrderManager;

    @GetMapping("/returnReason/list")
    public R<PageBeanVo> returnReasonByPage(@RequestParam Integer pageNum,
                                            @RequestParam Integer pageSize){
        return omsOrderManager.returnReasonByPage(pageNum,pageSize);
    }

    @PostMapping("/returnReason/create")
    public R returnReasonSave(@RequestBody OmsOrderReturnReason returnReason){
        return omsOrderManager.returnReasonSave(returnReason);
    }

    @PostMapping("/returnReason/delete")
    public R returnReasonDeleteByIds(@RequestParam Integer[] ids){
        return omsOrderManager.returnReasonDeleteByIds(ids);
    }
    @PostMapping("/returnReason/update/status")
    public R returnReasonUpdateStatus(@RequestParam Integer[] ids,
                                      @RequestParam Integer status){
        return omsOrderManager.returnReasonUpdateStatus(ids,status);
    }
    @GetMapping("/returnReason/{id}")
    public R returnReasonSelectById(@PathVariable Integer id){
        return omsOrderManager.returnReasonSelectById(id);
    }
    @PostMapping("/returnReason/update/{id}")
    public R returnReasonUpdateReason(@RequestBody OmsOrderReturnReason returnReason){
        return omsOrderManager.returnReasonUpdateReason(returnReason);
    }
}
